float4x4 World;
float4x4 View;
float4x4 Projection;

float3 LightPos;

texture NormalMap;
sampler2D normalSampler = sampler_state
{
    texture = NormalMap;
    AddressU = CLAMP;
    AddressV = CLAMP;
    FILTER = POINT;
};

texture WorldPosMap;
sampler2D wposSampler = sampler_state
{
    texture = WorldPosMap;
    AddressU = CLAMP;
    AddressV = CLAMP;
    FILTER = POINT;
};

texture TextureMap;
sampler2D texSampler = sampler_state
{
    texture = TextureMap;
    AddressU = CLAMP;
    AddressV = CLAMP;
    FILTER = POINT;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
    float3 TexCoords : TEXCOORD0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float3 TexCoords : TEXCOORD0;
    float3 LightDir : TEXCOORD1;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    output.TexCoords = input.TexCoords;
    output.LightDir = normalize(LightPos - worldPosition);

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    
    float3 diffuse = tex2D(texSampler, input.TexCoords).xyz;

    return (diffuse, 1);
}

technique Technique1
{
    pass Pass1
    {
        // TODO: set renderstates here.

        VertexShader = compile vs_3_0 VertexShaderFunction();
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}
